package org.liliya.controller;

import com.netflix.discovery.converters.Auto;
import org.liliya.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author liliya
 * @date 2021/4/24 14:37
 */
@Controller
public class ProductController {
    @Autowired
    ProductService productService;

    @Value("${version}")
    String version;

    @RequestMapping(value = "/products",method = RequestMethod.GET)
    public Object listProducts(Model model){
        model.addAttribute("ps",productService.productList());
        model.addAttribute("version",version);
         return "products";
    }
}
